# time of day makefile
TASK_DIR:=$(dir $(abspath $(lastword $(MAKEFILE_LIST))))

include ../../config.mk

# Scripts
RMD_FILE := $(TASK_DIR)/src/print_time_of_day_outcomes.Rmd

# Inputs
TIME_OF_DAY_REG_OUTPUT := $(TASK_DIR)/../../run_regressions/output/regression_output__time_of_day.csv
CONFIG_FILE := $(TASK_DIR)/hand/config.yaml

# Outputs
OUT_MAIN_FILE := $(OUT_DIR)/time_of_day_results_wide_up_to_date.tex
OUT_APPENDIX_FILE := $(OUT_DIR)/time_of_day_results_secondary_up_to_date.tex

# Recipe
$(OUT_APPENDIX_FILE): $(RMD_FILE) $(CONFIG_FILE)  $(TIME_OF_DAY_REG_OUTPUT) $(OUTCOME_LABELS_FILE) $(TABLE_CONFIG) $(TABLE_FNS)
	@mkdir -p $(OUT_DIR)
	@mkdir -p $(PAPER_OUT_DIR)
	$(R_script) -e "rmarkdown::render(input = '$(RMD_FILE)')"
	@cp $(OUT_DIR)/*up_to_date.tex $(PAPER_OUT_DIR)

